return "DISPLAY TEXT" & RETURN & RETURN & "This behavior allows you to display a given string in a Field or Text member. Use it with the 'Tooltip' and 'Hypertext - Display Status' behaviors which need a Field or Text member in which to display their information. Or create your own custom Lingo to display runtime information, such as the position of the mouse." & RETURN & RETURN & "This behavior waits for Lingo commands to tell it what to do. It is not active by itself." & RETURN & RETURN & "You can choose between two display types: tooltip and status bar." & RETURN & RETURN & "The TOOLTIP type of display will make the Field or Text member resize itself to fit the text, and disappear when it is empty. You can set the tooltip type display to appear at any position on the stage, for example: under the cursor. If no position is sent to the sprite, it will appear at the top left corner of the Stage. See the 'Tooltip' behavior for more details." & RETURN & RETURN & "If you wish to display several lines of text, you must use RETURN characters to define the line breaks. An empty tooltip sprite will move off-stage to hide. It is recommended to place it off-stage before it is used, in case it causes a brief flash on the screen." & RETURN & RETURN & "The STATUS BAR type of display will appear on Stage at all times. It will not resize or change position. Any positional information sent to this sprite will be ignored if it is set to act as a status bar. If the text is too long to appear in the member of the current sprite, a scrollbar will appear. You do not need to divide the text with RETURN characters. If you think that a scrollbar may be necessary, make sure that the Field or Text member is sufficiently tall for the scroll arrows to operate correctly." & RETURN & RETURN & "Set the font size and other characteristics of Field or Text member to customize the appearance of the message." & RETURN & RETURN & "Be sure to give the Text or Field member a name. It may be emptied by this behavior. Director 7 automatically erases nameless empty members." & RETURN & RETURN & "PERMITTED MEMBER TYPES:" & RETURN & "Field and Text members" & RETURN & RETURN & "PARAMETERS:" & RETURN & "* Display type:" & RETURN & " - Tooltip (appears near the cursor on rollover)" & RETURN & " - Status bar (appears in a fixed position at all times)" & RETURN & RETURN & "ASSOCIATED BEHAVIORS:" & RETURN & "+ Tooltip" & RETURN & "+ Source Status" & RETURN & "+ Hypertext - Display Status" & RETURN & RETURN & "PUBLIC METHODS:" & RETURN & "=> Set the text to display (and the position of the sprite)"
end
on getBehaviorTooltip me
vTip = "Use with Field or Text members." & RETURN & RETURN
vTip = vTip & "This behavior waits for a message from another" & RETURN
vTip = vTip & "behavior or custom handler to display a character" & RETURN
vTip = vTip & "string. It is intended to be used with the 'Tooltip'," & RETURN
stageWidth = (the activeWindow).rect.right - (the activeWindow).rect.left
stageHeight = (the activeWindow).rect.bottom - (the activeWindow).rect.top
maxH = stageWidth - memberRect.width
maxV = stageHeight - memberRect.height
theLoc[1] = max(0, min(theLoc[1], maxH))
theLoc[2] = max(0, min(theLoc[2], maxV))
theLoc = theLoc + myMember.regPoint
mySprite.loc = theLoc
else
lastChar = theString.char.count
textHeight = charPosToLoc(myMember, lastChar)[2]
if textHeight > mySprite.height then
myMember.boxType = #scroll
else
myMember.boxType = #fixed
end if
end if
end if
end
on DisplayText_GetReference me
return me
end
on ErrorAlert me, theError, data
case theError of
#getPDLError:
alert("Error: This behavior works only with Field and Text members." & RETURN & RETURN & "Hit OK and then delete this behavior from the sprite." & RETURN & RETURN & "For more information on deleting Behaviors, see the Help system.")
if the optionDown then
return [#getPDLError: [#comment: "ERROR: Wrong member type. Click 'Cancel'." & RETURN & " Use only with Field and Text members.", #format: #string, #range: [EMPTY], #default: EMPTY]]
end if
otherwise:
case theError of
#invalidMemberType:
behaviorName = string(me)
delete word 1 of behaviorName
delete char -30001 of behaviorName
delete char -30001 of behaviorName
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & RETURN & "Behavior " & behaviorName & " only works with Field and Text members." & RETURN & RETURN & "Current member type = #" & data)
halt()
#invalidString:
if the runMode = "Author" then
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & "Behavior " & behaviorName & RETURN & RETURN & "The DisplayText_SetText handler could not treat the following as a string:" & RETURN & RETURN & data)
end if
#invalidPoint:
if the runMode = "Author" then
alert("BEHAVIOR ERROR: Frame " & the frame & ", Sprite " & me.spriteNum & RETURN & "Behavior " & behaviorName & RETURN & RETURN & "The DisplayText_SetText handler could not treat the following as a point:" & RETURN & RETURN & data)
end if
end case
end case
end
on getPropertyDescriptionList me
if not (the currentSpriteNum) then
exit
end if
theMember = sprite(the currentSpriteNum).member
case theMember.type of
#field, #text:
otherwise:
return ErrorAlert(me, #getPDLError)
end case
return [#myDisplayType: [#comment: "Display Text sprite behaves as a:", #format: #symbol, #range: ["status bar (fixed size and position)", "tooltip (dynamic size and position)"], #default: "in a fixed position (status bar)"]]